package com.zyb.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.springframework.context.expression.MapAccessor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zyb.pojo.Message;
import com.zyb.service.MessageService;


@Controller
public class UserController {

	@Resource(name="MessageService")
	private MessageService messageService;
	
	
	@RequestMapping(value="/message")
	public @ResponseBody String message(String name,String phone,String msg) {

		Message message = new Message(msg, name, phone);
		String result = messageService.saveMessage(message);
		
		return result;
		
	}
}
